﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Saker.Kernel.DAL;
using Saker.Kernel.Model;

namespace Saker.Kernel.BLL
{
    #region SysDepartment业务逻辑层
	/// <summary>
	///SysDepartment业务逻辑层
	/// </summary>
    public partial class SysDepartmentBLL
    {
         #region SysEvent业务逻辑层 自动生成
        /// <summary>
        /// 添加SysDepartment
        /// </summary>
        /// <param name="SysDepartment">SysDepartment实体</param>
        /// <returns>添加后的SysDepartment实体</returns>
        public SysDepartment Add(SysDepartment sysDepartment)
        {
            return new SysDepartmentDAL().Add(sysDepartment);
        }
        /// <summary>
        /// 根据主键删除SysDepartment
        /// </summary>
        /// <param name="DepartID">DepartID主键</param>
        /// <returns>影响的行数</returns>
        public int DeleteByDepartID(int departID)
        {
            return new SysDepartmentDAL().DeleteByDepartID(departID);
        }
        /// <summary>
        /// 根据主键更新
        /// </summary>
        /// <param name="SysDepartment">SysDepartment实体</param>
        /// <returns>影响的行数</returns>
		public int Update(SysDepartment sysDepartment)
        {
            return new SysDepartmentDAL().Update(sysDepartment);
        }
        
        /// <summary>
        /// 根据主键得到实体
        /// </summary>
        /// <param name="DepartID">DepartID主键</param>
        /// <returns>SysDepartment实体</returns>
        public SysDepartment GetByDepartID(int departID)
        {
            return new SysDepartmentDAL().GetByDepartID(departID);
        }
        /// <summary>
        /// 得到总行数
        /// </summary>
        /// <returns>总行数</returns>
		public int GetTotalCount()
		{
			return new SysDepartmentDAL().GetTotalCount();
		}
		/// <summary>
		/// 分页，仅sql 2005及以上版本使用
		/// </summary>
		/// <param name="minrownum">开始行数</param>
		/// <param name="maxrownum">结束行数</param>
		/// <returns>SysDepartment实体集合</returns>
		public IEnumerable<SysDepartment> GetPagedData(int minrownum,int maxrownum)
		{
			return new SysDepartmentDAL().GetPagedData(minrownum,maxrownum);
		}
        /// <summary>
        /// 分页，调用存储过程
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="recordCount">记录数</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageCount">总页数</param>
        /// <param name="whereCondition">where</param>
        /// <returns>DataTable数据集</returns>
        public DataTable GetPagingRecord(int pageIndex, ref int recordCount, int pageSize, ref int pageCount,string whereCondition)
        {
            return new SysDepartmentDAL().GetPagingRecord(pageIndex, ref recordCount,pageSize,ref pageCount,whereCondition);
        }
		/// <summary>
		/// 得到所有SysDepartment实体集合
		/// </summary>
		/// <returns>SysDepartment实体集合</returns>
		public IEnumerable<SysDepartment> GetAll()
		{
			return new SysDepartmentDAL().GetAll();
		}
        /// <summary>
        /// 根据上级部门ID得到所有SysDepartment集合
        /// </summary>
        /// <returns>所有集合</returns>
        public IEnumerable<SysDepartment> GetAllByParentID(int parentid)
        {
            return new SysDepartmentDAL().GetAllByParentID(parentid);
        }
        #endregion

        public bool Add(int ParentID, string DepartName)
        {
            return new SysDepartmentDAL().Add(ParentID, DepartName);
        }
    }
    #endregion
}
